package com.carorder.model;

import java.sql.*;
import java.util.*;

public class ApplyVO {
	public static Map<String, ArrayList<ApplyVO>> applyMap = new HashMap<String, ArrayList<ApplyVO>>();

	private String driverPathId;
	private String riderPathId;
	private String approver;
	private String applicant;
	private String riderId;
	private String driverId;
	private java.util.Date createTime;
	private Integer fee;
	private String startPoint;
	private Timestamp departureTime;
	private String endPoint; 
	private Timestamp arrivalTime;
	private String status;
	private boolean init;
	
	public static ApplyVO getByDriverAndRiderId(String driverPathId, String riderPathId) {
		ArrayList<ApplyVO> applyList = applyMap.get(driverPathId);
		ApplyVO applyVO = getByRiderPathId(applyList, riderPathId);
		
		return applyVO;
	}
	
	public static ApplyVO getByRiderPathId(ArrayList<ApplyVO> applyList, String riderPathId) {
		ApplyVO res = null;
		for (ApplyVO vo : applyList) {
			if (vo.getRiderPathId().equals(riderPathId)) {
				res = vo;
				break;
			}
		}
		return res;
	}
	
	public static ApplyVO getByRiderPathId(String riderPathId) {
		ArrayList<ApplyVO> applyList = null;
		ApplyVO res = null;
		Collection<String> keySet = applyMap.keySet();
		for (String key : keySet) {
			applyList = applyMap.get(key);
			res = getByRiderPathId(applyList, riderPathId);
			if (res != null)
				break;
		}
		return res;
	}
	
	public static ApplyVO getApproverByPathId(ArrayList<ApplyVO> applyList, String pathId) {
		ApplyVO res = null;
		for (ApplyVO vo : applyList) {
			if (vo.getApprover().equals(pathId)) {
				res = vo;
				break;
			}
		}
		return res;
	}
	
	public static ArrayList<ApplyVO> getByDriverPathId(String driverPathId) {
		return applyMap.get(driverPathId);
	}
	
	public String getDriverPathId() {
		return driverPathId;
	}
	public void setDriverPathId(String driverPathId) {
		this.driverPathId = driverPathId;
	}
	public String getRiderPathId() {
		return riderPathId;
	}
	public void setRiderPathId(String riderPathId) {
		this.riderPathId = riderPathId;
	}
	public String getApprover() {
		return approver;
	}
	public void setApprover(String approver) {
		this.approver = approver;
	}
	public String getApplicant() {
		return applicant;
	}
	public void setApplicant(String applicant) {
		this.applicant = applicant;
	}
	public java.util.Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(java.util.Date createTime) {
		this.createTime = createTime;
	}
	public Integer getFee() {
		return fee;
	}
	public void setFee(Integer fee) {
		this.fee = fee;
	}
	public String getStartPoint() {
		return startPoint;
	}
	public void setStartPoint(String startPoint) {
		this.startPoint = startPoint;
	}
	public String getEndPoint() {
		return endPoint;
	}
	public void setEndPoint(String endPoint) {
		this.endPoint = endPoint;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getRiderId() {
		return riderId;
	}
	public void setRiderId(String riderId) {
		this.riderId = riderId;
	}
	public String getDriverId() {
		return driverId;
	}

	public void setDriverId(String driverId) {
		this.driverId = driverId;
	}

	public boolean isInit() {
		return init;
	}

	public void setInit(boolean init) {
		this.init = init;
	}

	public Timestamp getDepartureTime() {
		return departureTime;
	}

	public void setDepartureTime(Timestamp departureTime) {
		this.departureTime = departureTime;
	}

	public Timestamp getArrivalTime() {
		return arrivalTime;
	}

	public void setArrivalTime(Timestamp arrivalTime) {
		this.arrivalTime = arrivalTime;
	}
}
